/*
 * capture_soc_imx6.c
 *
 *  Created on: 2024-4-15
 *      Author: NI
 */

#include <errno.h>
#include "load_platfrom_lib.h"
#include "capture_soc_imx6.h"
#include "platfrom_type.h"

typedef struct{
	int device;
	int source;
	int vchannel;
}vchannel_config_t;

vchannel_config_t vchannel_config[4] = {

};

static int vchannel_setting(capture_dev_t * dev){
	int ret = EOK, device = 0, source = 0;
	switch(dev->vchannel){
		case 0:
			ret = api_tab.capture_set_property_i(dev->context, CAPTURE_PROPERTY_DEVICE, device);
			if(ret)	return ret;
			ret = api_tab.capture_set_property_i(dev->context, CAPTURE_PROPERTY_SRC_INDEX, source);
		default:
			break;
	}
	return EOK;
}

int capture_soc_init(capture_dev_t * dev){
	int ret = EOK;
	ret = load_platfrom_lib();
	if(ret != EOK)
		return ret;
	dev->context = api_tab.capture_create_context(0);
	dev->platfrom =	get_cpu_type();
	if(dev->platfrom == -1){
		return ENOTSUP;
	}

	vchannel_setting(dev);


	return EOK;
}

int capture_soc_set_vchannel(int vc){
//	dev->vchannel = vc;
	return EOK;
}

int capture_soc_set_format(int format){
//	dev->format = format;
	return EOK;
}

int capture_soc_set_interface_type(capture_dev_t * dev){
	return EOK;
}

int capture_soc_set_deinterlace_mode(){
	return EOK;
}

int capture_soc_set_deinterlace_flag(){
	return EOK;
}

int capture_soc_set_frame_nbuffers(){
	return EOK;
}

int capture_soc_set_frame_buffers(){
	return EOK;
}

int capture_soc_update(){
	return EOK;
}

int capture_soc_deinit(){
	int ret = EOK;
	ret = unload_platfrom_lib();
	if(ret != EOK)
		return ret;
	return EOK;
}


